Cylinder = cc.Node.extend({

	ctor:function(parent,tag){
		this._super();
		parent.addChild(this,9,TAG_CYLINDER_NODE);
		this.init();
	},
	init:function(tag){
		var cylinder = new Button(this, 10, TAG_CYLINDER,"#cylinder.png", this.callback);


	},
	callback:function(p){
		var action = gg.flow.flow.action;
		var func = cc.callFunc(this.actionDone, this);	
		func.retain();
		var hand = new Hand();
		
		switch(p.getTag()){
		case TAG_CYLINDER:
			var move = cc.moveTo(1,cc.p(455,190));
			var rotate = cc.rotateTo(1, 100);
			var spawn = cc.spawn(move,rotate);
			var delay = cc.delayTime(2);
			var move2 = cc.moveTo(1,cc.p(480,150));
			var rotate2 = cc.rotateTo(1, 0);
			var spawn2 = cc.spawn(move2,rotate2);
			var seq = cc.sequence(spawn, delay, spawn2,cc.callFunc(function(){
				this.setVisible(false);
			},this),cc.callFunc(function() {
				ll.run.clock.doing();
			}, this),cc.delayTime(4),cc.callFunc(function() {
				ll.run.clock.stop();
				ll.run.clock.time.setVisible(true);

			}, this),cc.delayTime(1),cc.callFunc(function(){
				ll.run.clock.time.setVisible(false);
				ll.run.clock.setVisible(false);
			},this),
			cc.callFunc(this.flowNext,this));
			
			
			var beakernode = this.getParent().getChildByTag(TAG_BEAKER_NODE);
			var beaker=beakernode.getChildByTag(TAG_BEAKER);
			beaker.setCascadeOpacityEnabled(true);
			
			beaLine =beaker.getChildByTag(TAG_BEAKER_LINE);
			beaLine.runAction(cc.sequence(cc.delayTime(1),cc.moveTo(1,cc.p(beaker.width*0.8-15,beaker.height * 0.8))));

			p.runAction(func);
			this.runAction(seq);
			
			break;


		}
	},

	actionDone:function(p){
		var action = gg.flow.flow.action;
		var func = cc.callFunc(this.actionDone, this);
		var hand=new Hand();
		switch(p.getTag()){
		case TAG_CYLINDER:
			// 导入3ml的浓Hcl
			var parent=this.getParent();
			var shuiliu = new cc.Sprite("#flow_left.png");
			shuiliu.setOpacity(0);
			shuiliu.setScale(0.8);
			shuiliu.setRotation(10);
			shuiliu.setPosition(540, 140);
			parent.addChild(shuiliu);
			var seq = cc.sequence(cc.delayTime(1),cc.fadeTo(0.5,255),cc.delayTime(1.0),cc.fadeTo(0.6,0),cc.callFunc(function(){
				shuiliu.removeFromParent();
			},this));
			shuiliu.runAction(seq);
//
			var rodnode = this.getParent().getChildByTag(TAG_ROD_NODE);
			var blb=rodnode.getChildByTag(TAG_ROD);
			blb.setScale(1,1.5);
			blb.setVisible(true);
//			var move3 = cc.moveBy(1.5,cc.p(150,-245));
			var move3=cc.bezierBy(1.5,[cc.p(240,-55),cc.p(145,-150),cc.p(150,-230)])
			var rotate2 = cc.rotateTo(1,-10);
			var spawn3 = cc.spawn(move3,rotate2);
			var rotate3 = cc.rotateTo(0.4,10);
			var rotate4 = cc.rotateTo(0.4,-10);

			var fade = cc.fadeTo(1,0);
			var delay1 = cc.delayTime(2);
			var seq1 = cc.sequence(cc.callFunc(function(){
				hand.addrighthand(rodnode, "#hand/hand_right", cc.p(25,5),0.6);
			}, this),spawn3,rotate3,rotate4,rotate3,rotate4,rotate4,rotate4,cc.callFunc(function(){
				hand.removehand(rodnode, 1, 2);
			},this));
			rodnode.runAction(seq1);
			
			break;



		}
	},

	flowNext:function(){

		gg.flow.next();
		cc.log("下一步"+gg.flow.flow.tag);
	},
	

});